<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2022/9/22
  Time: 16:21
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page isELIgnored="false" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<html>
<head>
    <title>Title</title>
    <meta charset="UTF-8">
    <title>Title</title>
    <link rel="stylesheet" href="../css/bootstrap.min.css" />
    <link rel="stylesheet" href="../css/dashboard.css" />
    <link rel="stylesheet" href="../css/dialog.css" />
</head>
<body>
<!--上部导航栏start-->
<nav class="navbar navbar-inverse navbar-fixed-top">
    <div class="container-fluid">
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="#">众筹管理平台</a>
        </div>
        <div id="navbar" class="navbar-collapse collapse">

            <ul class="nav navbar-nav navbar-right">
                <li><a href="../index.jsp">首页</a></li>
                <li><a href="#">欢迎, ${admin.name}</a></li>
                <li><a href="#" title="修改个人资料和密码的页面">设置</a></li>
                <li><a href="/admin/logout" title="退出登录">退出</a></li>
            </ul>
        </div>
    </div>
</nav>
<!--上部导航栏end-->
<div class="container-fluid">
    <div class="row">
        <!--左侧导航栏start-->
        <div class="col-sm-3 col-md-2 sidebar">
            <ul class="nav nav-sidebar">
                <li ><a href="../index.jsp">首页</a></li>
            </ul>
            <ul class="nav nav-sidebar">
                <li><a href="../products.jsp">所有项目*</a></li>
                <li><a href="#">项目审核</a></li>
                <li><a href="#">项目跟踪</a></li>
                <li><a href="#">项目评论</a></li>
                <li><a href="all_classity.jsp">项目分类*</a></li>
                <li><a href="#">项目推荐</a></li>
            </ul>
            <ul class="nav nav-sidebar">
                <li class="active"><a href="/user/getAllUser">注册用户</a></li>
                <li><a href="/user/getUserMoney">用户资金</a></li>
                <li><a href="userLogInfo.jsp">用户日志</a></li>
                <li><a href="/user/getAllUserAudit">实名审核</a></li>
            </ul>
            <ul class="nav nav-sidebar">
                <li><a href="">新闻管理</a></li>
                <li><a href="">问题管理</a></li>
                <li><a href="">管理用户</a></li>
                <li><a href="">管理日志</a></li>
            </ul>
        </div>
        <!--左侧导航栏end-->
        <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
            <h1 class="page-header">众筹项目分类</h1>

            <div class="panel panel-default">
            </div>
            <div class="panel panel-default">
                <div class="panel-heading">
                    <div class="panel-title">
                        注册用户管理
                    </div>
                </div>
                <div class="panel panel-default">
                    <div class="panel-body">
                        <form class="form-inline" action="/user/getUserByName" method="post">
                            <div class="form-group">
                                <input type="text" class="form-control" id="exampleInputName2" placeholder="用户名" name="username">
                            </div>
                            <button type="submit" class="btn btn-default btn-primary">查询</button>
                        </form>
                    </div>
                </div>
                <div class="panel-body">
                    <div class="table-responsive ">
                        <table class="table table-striped table-bordered">
                            <thead>
                            <tr>
                                <th hidden>编号</th>
                                <th>用户姓名</th>
                                <th>邮箱</th>
                                <th>密码</th>
                                <th>电话</th>
                                <th>真实姓名</th>
                                <th>身份证号</th>
                                <th>身份证照片</th>
                                <th>审核状态</th>
                                <th>修改</th>
                                <th>删除</th>
                            </tr>
                            </thead>
                            <tbody>
                            <c:forEach items="${users}" var="user">
                                <tr>
                                    <td hidden>${user.id}</td>
                                    <td>${user.username}</td>
                                    <td>${user.email}</td>
                                    <td>${user.password}</td>
                                    <td>${user.phone}</td>
                                    <td>${user.realname}</td>
                                    <td>${user.idcard}</td>
                                    <td>${user.cardUrl}</td>
                                    <td>${user.status==1?"审核中":user.status==2?"审核通过 ":user.status==3?"审核失败 ":"未提交"}</td>
                                    <td>
                   <a href="" data-toggle="modal"
                       data-target="#myModal">
                       <span class="glyphicon glyphicon-pencil"></span></a>
                       </td>
                    <td><span class="glyphicon glyphicon-trash" id="${user.id}"></span></td>
                        </tr>
                        </c:forEach>
                            </tbody>
                        </table>
                    </div>

                    <!--模态框-->
                    <div class="modal fade" id="myModal" tabindex="-1" role="dialog"
                         aria-labelledby="myModalLabel" aria-hidden="true">
                        <div class="modal-dialog">
                            <div class="modal-content">
                                <div class="modal-header">
                                    <button type="button" class="close" data-dismiss="modal"
                                            aria-hidden="true">&times;</button>
                                    <h4 class="modal-title" id="myModalLabel">用户信息</h4>
                                </div>
                                <div class="modal-body">
                                    <div class="form">
                                        <form class="form-validate form-horizontal" id="feedback_form" action="/user/updateUserById"
                                              method="post">
                                            <div class="form-group ">
                                                <label for="u_id" class="control-label col-lg-2">用户编号<span
                                                        class="required"> *</span></label>
                                                <div class="col-lg-10">
                                                <input class="form-control" id="u_id" type="text" name="id" readonly />
                                                </div>
                                            </div>

                                            <div class="form-group ">
                                                <label for="u_name" class="control-label col-lg-2">用户姓名<span
                                                        class="required"> *</span></label>
                                                <div class="col-lg-10">
                                                 <input class="form-control" id="u_name" type="text" name="username"/>
                                                </div>
                                            </div>
                                            <div class="form-group ">
                                                <label for="u_pwd" class="control-label col-lg-2">用户密码<span
                                                        class="required"> *</span></label>
                                                <div class="col-lg-10">
                                                    <input class="form-control" id="u_pwd" type="text" name="pwd" />
                                                </div>
                                            </div>
                                            <div class="form-group ">
                                                <label class="control-label col-lg-2">审核状态<span
                                                        class="required"> *</span></label>
                                                <div class="col-lg-10">
<%--                                                    <input class="form-control" id="u_status" type="text" name="status"/>--%>
                                                    <select  name="status">
                                                        <option value="0" >未提交</option>
                                                        <option value="1">审核中</option>
                                                        <option value="2">审核成功</option>
                                                        <option value="3">审核失败</option>
                                                    </select>
                                                </div>
                                            </div>
                                            <div class="form-group" style="text-align: right;">
                                                <div class="col-lg-offset-2 col-lg-10">
                                                    <button class="btn btn-primary" type="submit" onclick="">保存</button>
                                                    <button class="btn btn-default" type="reset">重置</button>
                                                </div>
                                            </div>
                                        </form>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>

           <nav aria-label="Page navigation" class="text-right">
            <ul class="pagination">
           <c:if test="${pageInfo.hasPreviousPage}">
          <li class="disabled">
          <a href="/user/getAllUser?pageNo=${pageInfo.pageNum-1}" aria-label="Previous">
          <span aria-hidden="true">&laquo;</span>
         </a>
          </li>
         </c:if>
         <c:forEach items="${pageInfo.navigatepageNums}" var="page_Num">
         <li
          <c:if test="${page_Num==pageInfo.pageNum}">
         class="active"
         </c:if>
          >
         <a href="/user/getAllUser?pageNo=${page_Num}">${page_Num}</a>
       </li>
        </c:forEach>
      <c:if test="${pageInfo.hasNextPage}">
     <li>
      <a href="/user/getAllUser?pageNo=${pageInfo.pageNum+1}" aria-label="Next">
      <span aria-hidden="true">&raquo;</span>
      </a>
      </li>
  </c:if>
        <li><a href="/user/getAllUser?pageNo=${pageInfo.pages}">末页</a></li>
        </ul>
       </nav>
        </div>
          </div>
        </div>
    </div>
</div>
<script type="text/javascript" src="../js/jquery1.12.4.min.js" ></script>
<script type="text/javascript" src="../js/bootstrap.min.js" ></script>
<script type="text/javascript" src="../js/countUp.js" ></script>
<script type="text/javascript" src="../js/dialog.js" ></script>
<script>
    $(document).ready(function () {
        $("span[class='glyphicon glyphicon-trash']").click(function () {
            alert($(this).attr('id'))
            var con=confirm("确定要删除吗?")
            if(con){
                window.location.href="/user/deleteUserById?id="+$(this).attr("id");
            }
        })

        $("span[class='glyphicon glyphicon-pencil']").click(function (e) {
            //回显数据
            var id = $(this).parent().parent().parent().find("td")[0]
            var username = $(this).parent().parent().parent().find("td")[1]
            var password = $(this).parent().parent().parent().find("td")[3]
            var  status = $(this).parent().parent().parent().find("td")[8]
            $("#u_id").val($(id).html());
            $("#u_name").val($(username).html());
            $("#u_pwd").val($(password).html());
            $("#u_status").val($(status).html());
        })
    })
</script>
</body>
</html>
